package com.lin.healthmanagement.controller;

import com.lin.healthmanagement.dao.MenuDao;
import com.lin.healthmanagement.dao.UserDao;
import com.lin.healthmanagement.entity.MainMenu;
import com.lin.healthmanagement.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/test")
public class TestController {

    @Autowired
    UserDao userDao;

    @Autowired
    MenuDao menuDao;

    @GetMapping("/1")
    public String test(){
        return  "ok";
    }

    @GetMapping("/2")
    public String test2(@RequestBody User user){
        User us=userDao.getUserByMessage(user.getUserName(),user.getPassword());
        System.out.println(us);
        return "0k";
    }

    @GetMapping("/3")
    public String test3(){
        List<MainMenu> mns=menuDao.getMenus();
        System.out.println(mns);
        return "ok";
    }

}
